﻿<template>
  <div class="nav-container">
    <div :span="4" class="nav-item" v-for="(item, index) in navList" :key="item.key">
      <div
        :class="{
          'nav-item-step': true,
          'nav-item-step-active': item.step === currentStep,
          'nav-item-step-normal': item.step !== currentStep,
        }"
      >
        <div class="nav-item-step-num">
          {{ item.step }}
        </div>
      </div>
      <div class="nav-item-title">{{ item.title }}</div>
      <div class="nav-item-line" v-if="index !== navList.length - 1">
        <div class="nav-item-line-dash"></div>
        <base-icon name="iconfont ic-xiajiantou1" :size="10" color="var(--cb1)" />
      </div>
    </div>
  </div>
</template>

<script setup>
  const props = defineProps({
    currentStep: {
      type: Number,
      default: 1,
    },
  });
  // 导航
  const navList = reactive([
    { key: "category", title: "选择商品类目", step: 1 },
    { key: "information", title: "设置商品信息", step: 2 },
    { key: "lease", title: "租赁设置", step: 3 },
    { key: "plan", title: "方案设置", step: 4 },
    { key: "publish", title: "发布商品", step: 5 },
  ]);
  // 当前高亮导航
  const currentKey = ref("category");
  // 当前步骤
  // const currentStep = ref(1);
</script>

<style lang="scss" scoped>
  .nav-container {
    width: 100%;
    background-color: var(--fl7);
    border-radius: 12px;
    overflow: hidden;
    padding: 22px 40px;
    display: flex;
    .nav-item {
      width: 20%;
      position: relative;
      height: 36px;
      display: flex;
      justify-content: center;
      align-items: center;

      .nav-item-step {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-right: 10px;
        .nav-item-step-num {
          width: 28px;
          height: 28px;
          display: flex;
          align-items: center;
          justify-content: center;
          border-radius: 50%;
          font-size: 16px;
        }
      }
      .nav-item-step-active {
        border: 1px dashed var(--bd);
        color: #fff;
        .nav-item-step-num {
          background: linear-gradient(130.6deg, var(--bd7) 0.82%, var(--bd) 94.23%);
        }
      }
      .nav-item-step-normal {
        border: 1px dashed var(--fl1);
        color: var(--ct2);
        .nav-item-step-num {
          background: var(--fl1);
        }
      }
      .nav-item-title {
        color: var(--ct1);
        font-size: 16px;
      }
      .nav-item-line {
        width: 50%;
        position: absolute;
        top: 14px;
        display: flex;
        align-items: center;
        justify-content: center;
        right: -26%;
        .nav-item-line-dash {
          width: 100%;
          height: 1px;
          border: 1px dashed var(--cb1);
          color: var(--cb1);
        }
      }
    }
  }
</style>
